package com.lixinlei.springboot_servlet.servlet.servletContextInitializer;

import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//@WebServlet(name = "servletContextInitializer", urlPatterns = "/servletContextInitializer",
//        initParams = {
//            @WebInitParam(name = "name", value = "javastack"),
//            @WebInitParam(name = "sex", value = "man")
//        }
//)
public class ServletContextInitializerServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        String name = getServletConfig().getInitParameter("className");
        resp.getOutputStream().println("className is : " + name);
    }

}
